package c.a.a.b0.l;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import c.a.a.b0.f;
import c.a.a.l;
import c.a.a.u;
import c.a.a.z.b.e;
import c.a.a.z.c.a;
import c.a.a.z.c.c;
import c.a.a.z.c.g;
import c.a.a.z.c.o;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/* compiled from: BaseLayer */
public abstract class b implements e, c.a.a.z.c.a.b, f {
    public final Path a = new Path();
    public final Matrix b = new Matrix();
    public final Paint c;
    public final Paint d;
    public final Paint e;
    public final Paint f;
    public final Paint g;
    public final RectF h;
    public final RectF i;
    public final RectF j;
    public final RectF k;
    public final String l;
    public final Matrix m;
    public final l n;
    public final e o;
    public g p;
    public c q;
    public b r;
    public b s;
    public List<b> t;
    public final List<a<?, ?>> u;
    public final o v;
    public boolean w;

    public b(l lVar, e eVar) {
        boolean z = true;
        this.c = new c.a.a.z.a(1);
        this.d = new c.a.a.z.a(1, Mode.DST_IN);
        this.e = new c.a.a.z.a(1, Mode.DST_OUT);
        c.a.a.z.a aVar = new c.a.a.z.a(1);
        this.f = aVar;
        this.g = new c.a.a.z.a(Mode.CLEAR);
        this.h = new RectF();
        this.i = new RectF();
        this.j = new RectF();
        this.k = new RectF();
        this.m = new Matrix();
        this.u = new ArrayList();
        this.w = true;
        this.n = lVar;
        this.o = eVar;
        this.l = c.b.a.a.a.d(new StringBuilder(), eVar.c, "#draw");
        if (eVar.u == c.a.a.b0.l.e.b.INVERT) {
            aVar.setXfermode(new PorterDuffXfermode(Mode.DST_OUT));
        } else {
            aVar.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
        }
        c.a.a.b0.j.l lVar2 = eVar.i;
        Objects.requireNonNull(lVar2);
        o oVar = new o(lVar2);
        this.v = oVar;
        oVar.b(this);
        List list = eVar.h;
        if (!(list == null || list.isEmpty())) {
            g gVar = new g(eVar.h);
            this.p = gVar;
            for (a aVar2 : gVar.a) {
                aVar2.a.add(this);
            }
            for (a aVar22 : this.p.b) {
                e(aVar22);
                aVar22.a.add(this);
            }
        }
        if (this.o.t.isEmpty()) {
            r(true);
            return;
        }
        c cVar = new c(this.o.t);
        this.q = cVar;
        cVar.b = true;
        cVar.a.add(new a(this));
        if (((Float) this.q.e()).floatValue() != 1.0f) {
            z = false;
        }
        r(z);
        e(this.q);
    }

    public String a() {
        return this.o.c;
    }

    public void b(RectF rectF, Matrix matrix, boolean z) {
        this.h.set(0.0f, 0.0f, 0.0f, 0.0f);
        j();
        this.m.set(matrix);
        if (z) {
            List list = this.t;
            if (list != null) {
                for (int size = list.size() - 1; size >= 0; size--) {
                    this.m.preConcat(((b) this.t.get(size)).v.e());
                }
            } else {
                b bVar = this.s;
                if (bVar != null) {
                    this.m.preConcat(bVar.v.e());
                }
            }
        }
        this.m.preConcat(this.v.e());
    }

    public void c() {
        this.n.invalidateSelf();
    }

    public void d(List<c.a.a.z.b.c> list, List<c.a.a.z.b.c> list2) {
    }

    public void e(a<?, ?> aVar) {
        if (aVar != null) {
            this.u.add(aVar);
        }
    }

    public void f(c.a.a.b0.e eVar, int i, List<c.a.a.b0.e> list, c.a.a.b0.e eVar2) {
        if (eVar.e(this.o.c, i)) {
            if (!"__container".equals(this.o.c)) {
                eVar2 = eVar2.a(this.o.c);
                if (eVar.c(this.o.c, i)) {
                    list.add(eVar2.g(this));
                }
            }
            if (eVar.f(this.o.c, i)) {
                p(eVar, eVar.d(this.o.c, i) + i, list, eVar2);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:38:0x0136  */
    /* JADX WARNING: Removed duplicated region for block: B:37:0x012e  */
    /* JADX WARNING: Removed duplicated region for block: B:110:0x03ad A:{SYNTHETIC} */
    /* JADX WARNING: Removed duplicated region for block: B:75:0x024e  */
    public void g(android.graphics.Canvas r18, android.graphics.Matrix r19, int r20) {
        /*
        r17 = this;
        r0 = r17;
        r1 = r18;
        r2 = r19;
        r3 = r0.l;
        r4 = r0.w;
        if (r4 == 0) goto L_0x03eb;
    L_0x000c:
        r4 = r0.o;
        r4 = r4.v;
        if (r4 == 0) goto L_0x0014;
    L_0x0012:
        goto L_0x03eb;
    L_0x0014:
        r17.j();
        r3 = r0.b;
        r3.reset();
        r3 = r0.b;
        r3.set(r2);
        r3 = r0.t;
        r3 = r3.size();
        r4 = 1;
        r3 = r3 - r4;
    L_0x0029:
        if (r3 < 0) goto L_0x0041;
    L_0x002b:
        r5 = r0.b;
        r6 = r0.t;
        r6 = r6.get(r3);
        r6 = (c.a.a.b0.l.b) r6;
        r6 = r6.v;
        r6 = r6.e();
        r5.preConcat(r6);
        r3 = r3 + -1;
        goto L_0x0029;
    L_0x0041:
        r3 = "Layer#parentMatrix";
        c.a.a.c.a(r3);
        r3 = r0.v;
        r3 = r3.j;
        if (r3 != 0) goto L_0x004f;
    L_0x004c:
        r3 = 100;
        goto L_0x0059;
    L_0x004f:
        r3 = r3.e();
        r3 = (java.lang.Integer) r3;
        r3 = r3.intValue();
    L_0x0059:
        r5 = r20;
        r5 = (float) r5;
        r6 = 1132396544; // 0x437f0000 float:255.0 double:5.5947823E-315;
        r5 = r5 / r6;
        r3 = (float) r3;
        r5 = r5 * r3;
        r3 = 1120403456; // 0x42c80000 float:100.0 double:5.53552857E-315;
        r5 = r5 / r3;
        r5 = r5 * r6;
        r3 = (int) r5;
        r5 = r17.n();
        r6 = "Layer#drawLayer";
        r7 = 0;
        if (r5 != 0) goto L_0x0093;
    L_0x0071:
        r5 = r17.m();
        if (r5 != 0) goto L_0x0093;
    L_0x0077:
        r2 = r0.b;
        r4 = r0.v;
        r4 = r4.e();
        r2.preConcat(r4);
        r2 = r0.b;
        r0.l(r1, r2, r3);
        c.a.a.c.a(r6);
        r1 = r0.l;
        c.a.a.c.a(r1);
        r0.o(r7);
        return;
    L_0x0093:
        r5 = r0.h;
        r8 = r0.b;
        r9 = 0;
        r0.b(r5, r8, r9);
        r5 = r0.h;
        r8 = r17.n();
        if (r8 != 0) goto L_0x00a4;
    L_0x00a3:
        goto L_0x00c4;
    L_0x00a4:
        r8 = r0.o;
        r8 = r8.u;
        r10 = c.a.a.b0.l.e.b.INVERT;
        if (r8 != r10) goto L_0x00ad;
    L_0x00ac:
        goto L_0x00c4;
    L_0x00ad:
        r8 = r0.j;
        r8.set(r7, r7, r7, r7);
        r8 = r0.r;
        r10 = r0.j;
        r8.b(r10, r2, r4);
        r8 = r0.j;
        r8 = r5.intersect(r8);
        if (r8 != 0) goto L_0x00c4;
    L_0x00c1:
        r5.set(r7, r7, r7, r7);
    L_0x00c4:
        r5 = r0.b;
        r8 = r0.v;
        r8 = r8.e();
        r5.preConcat(r8);
        r5 = r0.h;
        r8 = r0.b;
        r10 = r0.i;
        r10.set(r7, r7, r7, r7);
        r10 = r17.m();
        r11 = 3;
        r12 = 2;
        if (r10 != 0) goto L_0x00e2;
    L_0x00e0:
        goto L_0x017f;
    L_0x00e2:
        r10 = r0.p;
        r10 = r10.c;
        r10 = r10.size();
        r13 = 0;
    L_0x00eb:
        if (r13 >= r10) goto L_0x0171;
    L_0x00ed:
        r14 = r0.p;
        r14 = r14.c;
        r14 = r14.get(r13);
        r14 = (c.a.a.b0.k.g) r14;
        r15 = r0.p;
        r15 = r15.a;
        r15 = r15.get(r13);
        r15 = (c.a.a.z.c.a) r15;
        r15 = r15.e();
        r15 = (android.graphics.Path) r15;
        r7 = r0.a;
        r7.set(r15);
        r7 = r0.a;
        r7.transform(r8);
        r7 = r14.a;
        r7 = r7.ordinal();
        if (r7 == 0) goto L_0x0120;
    L_0x0119:
        if (r7 == r4) goto L_0x017e;
    L_0x011b:
        if (r7 == r12) goto L_0x0120;
    L_0x011d:
        if (r7 == r11) goto L_0x017e;
    L_0x011f:
        goto L_0x0125;
    L_0x0120:
        r7 = r14.d;
        if (r7 == 0) goto L_0x0125;
    L_0x0124:
        goto L_0x017e;
    L_0x0125:
        r7 = r0.a;
        r14 = r0.k;
        r7.computeBounds(r14, r9);
        if (r13 != 0) goto L_0x0136;
    L_0x012e:
        r7 = r0.i;
        r14 = r0.k;
        r7.set(r14);
        goto L_0x0169;
    L_0x0136:
        r7 = r0.i;
        r14 = r7.left;
        r15 = r0.k;
        r15 = r15.left;
        r14 = java.lang.Math.min(r14, r15);
        r15 = r0.i;
        r15 = r15.top;
        r9 = r0.k;
        r9 = r9.top;
        r9 = java.lang.Math.min(r15, r9);
        r15 = r0.i;
        r15 = r15.right;
        r11 = r0.k;
        r11 = r11.right;
        r11 = java.lang.Math.max(r15, r11);
        r15 = r0.i;
        r15 = r15.bottom;
        r12 = r0.k;
        r12 = r12.bottom;
        r12 = java.lang.Math.max(r15, r12);
        r7.set(r14, r9, r11, r12);
    L_0x0169:
        r13 = r13 + 1;
        r7 = 0;
        r9 = 0;
        r11 = 3;
        r12 = 2;
        goto L_0x00eb;
    L_0x0171:
        r7 = r0.i;
        r7 = r5.intersect(r7);
        if (r7 != 0) goto L_0x017e;
    L_0x0179:
        r7 = 0;
        r5.set(r7, r7, r7, r7);
        goto L_0x017f;
    L_0x017e:
        r7 = 0;
    L_0x017f:
        r5 = r0.h;
        r8 = r18.getWidth();
        r8 = (float) r8;
        r9 = r18.getHeight();
        r9 = (float) r9;
        r5 = r5.intersect(r7, r7, r8, r9);
        if (r5 != 0) goto L_0x0196;
    L_0x0191:
        r5 = r0.h;
        r5.set(r7, r7, r7, r7);
    L_0x0196:
        r5 = "Layer#computeBounds";
        c.a.a.c.a(r5);
        r5 = r0.h;
        r5 = r5.isEmpty();
        if (r5 != 0) goto L_0x03e1;
    L_0x01a3:
        r5 = r0.c;
        r7 = 255; // 0xff float:3.57E-43 double:1.26E-321;
        r5.setAlpha(r7);
        r5 = r0.h;
        r8 = r0.c;
        r9 = 31;
        c.a.a.e0.g.f(r1, r5, r8, r9);
        r5 = "Layer#saveLayer";
        c.a.a.c.a(r5);
        r17.k(r18);
        r8 = r0.b;
        r0.l(r1, r8, r3);
        c.a.a.c.a(r6);
        r6 = r17.m();
        r8 = 19;
        r10 = "Layer#restoreLayer";
        if (r6 == 0) goto L_0x03b8;
    L_0x01cd:
        r6 = r0.b;
        r11 = r0.h;
        r12 = r0.d;
        c.a.a.e0.g.f(r1, r11, r12, r8);
        r11 = android.os.Build.VERSION.SDK_INT;
        r12 = 28;
        if (r11 >= r12) goto L_0x01df;
    L_0x01dc:
        r17.k(r18);
    L_0x01df:
        c.a.a.c.a(r5);
        r11 = 0;
    L_0x01e3:
        r12 = r0.p;
        r12 = r12.c;
        r12 = r12.size();
        if (r11 >= r12) goto L_0x03b2;
    L_0x01ed:
        r12 = r0.p;
        r12 = r12.c;
        r12 = r12.get(r11);
        r12 = (c.a.a.b0.k.g) r12;
        r13 = r0.p;
        r13 = r13.a;
        r13 = r13.get(r11);
        r13 = (c.a.a.z.c.a) r13;
        r14 = r0.p;
        r14 = r14.b;
        r14 = r14.get(r11);
        r14 = (c.a.a.z.c.a) r14;
        r15 = r12.a;
        r15 = r15.ordinal();
        r16 = 1076048691; // 0x40233333 float:2.55 double:5.316386915E-315;
        if (r15 == 0) goto L_0x0343;
    L_0x0216:
        if (r15 == r4) goto L_0x02d4;
    L_0x0218:
        r4 = 2;
        if (r15 == r4) goto L_0x025c;
    L_0x021b:
        r4 = 3;
        if (r15 == r4) goto L_0x0220;
    L_0x021e:
        goto L_0x03ad;
    L_0x0220:
        r12 = r0.p;
        r12 = r12.a;
        r12 = r12.isEmpty();
        if (r12 == 0) goto L_0x022b;
    L_0x022a:
        goto L_0x0246;
    L_0x022b:
        r12 = 0;
    L_0x022c:
        r13 = r0.p;
        r13 = r13.c;
        r13 = r13.size();
        if (r12 >= r13) goto L_0x024b;
    L_0x0236:
        r13 = r0.p;
        r13 = r13.c;
        r13 = r13.get(r12);
        r13 = (c.a.a.b0.k.g) r13;
        r13 = r13.a;
        r14 = c.a.a.b0.k.g.a.MASK_MODE_NONE;
        if (r13 == r14) goto L_0x0248;
    L_0x0246:
        r12 = 0;
        goto L_0x024c;
    L_0x0248:
        r12 = r12 + 1;
        goto L_0x022c;
    L_0x024b:
        r12 = 1;
    L_0x024c:
        if (r12 == 0) goto L_0x03ad;
    L_0x024e:
        r12 = r0.c;
        r12.setAlpha(r7);
        r12 = r0.h;
        r13 = r0.c;
        r1.drawRect(r12, r13);
        goto L_0x03ad;
    L_0x025c:
        r4 = 3;
        r12 = r12.d;
        if (r12 == 0) goto L_0x029e;
    L_0x0261:
        r12 = r0.h;
        r15 = r0.d;
        c.a.a.e0.g.f(r1, r12, r15, r9);
        r12 = r0.h;
        r15 = r0.c;
        r1.drawRect(r12, r15);
        r12 = r0.e;
        r14 = r14.e();
        r14 = (java.lang.Integer) r14;
        r14 = r14.intValue();
        r14 = (float) r14;
        r14 = r14 * r16;
        r14 = (int) r14;
        r12.setAlpha(r14);
        r12 = r13.e();
        r12 = (android.graphics.Path) r12;
        r13 = r0.a;
        r13.set(r12);
        r12 = r0.a;
        r12.transform(r6);
        r12 = r0.a;
        r13 = r0.e;
        r1.drawPath(r12, r13);
        r18.restore();
        goto L_0x03ad;
    L_0x029e:
        r12 = r0.h;
        r15 = r0.d;
        c.a.a.e0.g.f(r1, r12, r15, r9);
        r12 = r13.e();
        r12 = (android.graphics.Path) r12;
        r13 = r0.a;
        r13.set(r12);
        r12 = r0.a;
        r12.transform(r6);
        r12 = r0.c;
        r13 = r14.e();
        r13 = (java.lang.Integer) r13;
        r13 = r13.intValue();
        r13 = (float) r13;
        r13 = r13 * r16;
        r13 = (int) r13;
        r12.setAlpha(r13);
        r12 = r0.a;
        r13 = r0.c;
        r1.drawPath(r12, r13);
        r18.restore();
        goto L_0x03ad;
    L_0x02d4:
        r4 = 3;
        if (r11 != 0) goto L_0x02ea;
    L_0x02d7:
        r15 = r0.c;
        r4 = -16777216; // 0xffffffffff000000 float:-1.7014118E38 double:NaN;
        r15.setColor(r4);
        r4 = r0.c;
        r4.setAlpha(r7);
        r4 = r0.h;
        r15 = r0.c;
        r1.drawRect(r4, r15);
    L_0x02ea:
        r4 = r12.d;
        if (r4 == 0) goto L_0x032b;
    L_0x02ee:
        r4 = r0.h;
        r12 = r0.e;
        c.a.a.e0.g.f(r1, r4, r12, r9);
        r4 = r0.h;
        r12 = r0.c;
        r1.drawRect(r4, r12);
        r4 = r0.e;
        r12 = r14.e();
        r12 = (java.lang.Integer) r12;
        r12 = r12.intValue();
        r12 = (float) r12;
        r12 = r12 * r16;
        r12 = (int) r12;
        r4.setAlpha(r12);
        r4 = r13.e();
        r4 = (android.graphics.Path) r4;
        r12 = r0.a;
        r12.set(r4);
        r4 = r0.a;
        r4.transform(r6);
        r4 = r0.a;
        r12 = r0.e;
        r1.drawPath(r4, r12);
        r18.restore();
        goto L_0x03ad;
    L_0x032b:
        r4 = r13.e();
        r4 = (android.graphics.Path) r4;
        r12 = r0.a;
        r12.set(r4);
        r4 = r0.a;
        r4.transform(r6);
        r4 = r0.a;
        r12 = r0.e;
        r1.drawPath(r4, r12);
        goto L_0x03ad;
    L_0x0343:
        r4 = r12.d;
        if (r4 == 0) goto L_0x0383;
    L_0x0347:
        r4 = r0.h;
        r12 = r0.c;
        c.a.a.e0.g.f(r1, r4, r12, r9);
        r4 = r0.h;
        r12 = r0.c;
        r1.drawRect(r4, r12);
        r4 = r13.e();
        r4 = (android.graphics.Path) r4;
        r12 = r0.a;
        r12.set(r4);
        r4 = r0.a;
        r4.transform(r6);
        r4 = r0.c;
        r12 = r14.e();
        r12 = (java.lang.Integer) r12;
        r12 = r12.intValue();
        r12 = (float) r12;
        r12 = r12 * r16;
        r12 = (int) r12;
        r4.setAlpha(r12);
        r4 = r0.a;
        r12 = r0.e;
        r1.drawPath(r4, r12);
        r18.restore();
        goto L_0x03ad;
    L_0x0383:
        r4 = r13.e();
        r4 = (android.graphics.Path) r4;
        r12 = r0.a;
        r12.set(r4);
        r4 = r0.a;
        r4.transform(r6);
        r4 = r0.c;
        r12 = r14.e();
        r12 = (java.lang.Integer) r12;
        r12 = r12.intValue();
        r12 = (float) r12;
        r12 = r12 * r16;
        r12 = (int) r12;
        r4.setAlpha(r12);
        r4 = r0.a;
        r12 = r0.c;
        r1.drawPath(r4, r12);
    L_0x03ad:
        r11 = r11 + 1;
        r4 = 1;
        goto L_0x01e3;
    L_0x03b2:
        r18.restore();
        c.a.a.c.a(r10);
    L_0x03b8:
        r4 = r17.n();
        if (r4 == 0) goto L_0x03db;
    L_0x03be:
        r4 = r0.h;
        r6 = r0.f;
        c.a.a.e0.g.f(r1, r4, r6, r8);
        c.a.a.c.a(r5);
        r17.k(r18);
        r4 = r0.r;
        r4.g(r1, r2, r3);
        r18.restore();
        c.a.a.c.a(r10);
        r2 = "Layer#drawMatte";
        c.a.a.c.a(r2);
    L_0x03db:
        r18.restore();
        c.a.a.c.a(r10);
    L_0x03e1:
        r1 = r0.l;
        c.a.a.c.a(r1);
        r1 = 0;
        r0.o(r1);
        return;
    L_0x03eb:
        c.a.a.c.a(r3);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.a.a.b0.l.b.g(android.graphics.Canvas, android.graphics.Matrix, int):void");
    }

    public <T> void i(T t, c.a.a.f0.c<T> cVar) {
        this.v.c(t, cVar);
    }

    public final void j() {
        if (this.t == null) {
            if (this.s == null) {
                this.t = Collections.emptyList();
                return;
            }
            this.t = new ArrayList();
            for (Object obj = this.s; obj != null; obj = obj.s) {
                this.t.add(obj);
            }
        }
    }

    public final void k(Canvas canvas) {
        RectF rectF = this.h;
        canvas.drawRect(rectF.left - 1.0f, rectF.top - 1.0f, rectF.right + 1.0f, rectF.bottom + 1.0f, this.g);
        c.a.a.c.a("Layer#clearLayer");
    }

    public abstract void l(Canvas canvas, Matrix matrix, int i);

    public boolean m() {
        g gVar = this.p;
        return (gVar == null || gVar.a.isEmpty()) ? false : true;
    }

    public boolean n() {
        return this.r != null;
    }

    public final void o(float f) {
        u uVar = this.n.b.a;
        String str = this.o.c;
        if (uVar.a) {
            c.a.a.e0.e eVar = (c.a.a.e0.e) uVar.c.get(str);
            if (eVar == null) {
                eVar = new c.a.a.e0.e();
                uVar.c.put(str, eVar);
            }
            float f2 = eVar.a + f;
            eVar.a = f2;
            int i = eVar.b + 1;
            eVar.b = i;
            if (i == Integer.MAX_VALUE) {
                eVar.a = f2 / 2.0f;
                eVar.b = i / 2;
            }
            if (str.equals("__container")) {
                for (u.a a : uVar.b) {
                    a.a(f);
                }
            }
        }
    }

    public void p(c.a.a.b0.e eVar, int i, List<c.a.a.b0.e> list, c.a.a.b0.e eVar2) {
    }

    public void q(float f) {
        o oVar = this.v;
        a aVar = oVar.j;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.m;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.n;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.f;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.g;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.h;
        if (aVar != null) {
            aVar.h(f);
        }
        aVar = oVar.i;
        if (aVar != null) {
            aVar.h(f);
        }
        c cVar = oVar.k;
        if (cVar != null) {
            cVar.h(f);
        }
        c cVar2 = oVar.l;
        if (cVar2 != null) {
            cVar2.h(f);
        }
        int i = 0;
        if (this.p != null) {
            for (int i2 = 0; i2 < this.p.a.size(); i2++) {
                ((a) this.p.a.get(i2)).h(f);
            }
        }
        float f2 = this.o.m;
        if (f2 != 0.0f) {
            f /= f2;
        }
        c cVar3 = this.q;
        if (cVar3 != null) {
            cVar3.h(f / f2);
        }
        b bVar = this.r;
        if (bVar != null) {
            bVar.q(bVar.o.m * f);
        }
        while (i < this.u.size()) {
            ((a) this.u.get(i)).h(f);
            i++;
        }
    }

    public final void r(boolean z) {
        if (z != this.w) {
            this.w = z;
            this.n.invalidateSelf();
        }
    }
}
